using UnityEngine;

public class GameQuit : MonoBehaviour
{
    private InputActions _inputActions;

    private void Start()
    {
        GameObject _canvasui=GameObject.FindGameObjectWithTag("MenuUI");
        Transform _exitui=_canvasui?.transform.Find("ButtonQuit");
      
        _inputActions =new InputActions();
        _inputActions.Enable();
        _inputActions.Menu.Setting.performed +=context => {
            if (!context.performed) return;

            _exitui?.gameObject.SetActive(!_exitui.gameObject.activeSelf);
        };
    }
    public void Quit()
    {
        #if UNITY_EDITOR
            UnityEditor.EditorApplication.isPlaying = false;
        #else
            Application.Quit();
        #endif
    }

}
